package cn.itcast.erp.entity.utils;

import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * 分页父类
 * @author 崔凯铭，罗宇航
 * @date 2019/6/5
 */

public class Base {
    @JsonIgnore
    private Integer page;
    @JsonIgnore
    private Integer rows;

    public Integer getPage() {
        return page;
    }

    public void setPage(Integer page) {
        this.page = page;
    }

    public Integer getRows() {
        return rows;
    }

    public void setRows(Integer rows) {
        this.rows = rows;
    }

    @JsonIgnore
    public Integer getOffset(){
        if (page == null || rows == null) {
            return 0;
        }
        return (page - 1) * rows;
    }
}
